define hostgroup {
        hostgroup_name  dns
        alias           DNS Servers
        members         {% for host in vars['dns_external']|sort %}{{ host }}{% if not loop.last %}, {% endif %} {% endfor %}

}

define hostgroup {
        hostgroup_name  smtp_mm
        alias           SMTP MailMan Servers
        members         {% for host in groups["smtp_mm"]|sort %} {{ hostvars[host]["inventory_hostname_short"] }}.fedoraproject.org {% if not loop.last %}, {% endif %} {% endfor %}

}

define hostgroup {
        hostgroup_name proxies
        alias          Web Servers
        members         {% for host in groups["proxies_external"]|sort %} {{ hostvars[host]["inventory_hostname_short"] }}.fedoraproject.org {% if not loop.last %}, {% endif %} {% endfor %}

}

define hostgroup {
        hostgroup_name proxies_ocp4
        alias          OCP Web Servers
        members         {% for host in groups["proxies_ocp4"]|sort %} {{ hostvars[host]["inventory_hostname_short"] }}.fedoraproject.org {% if not loop.last %}, {% endif %} {% endfor %}

}

define hostgroup {
        hostgroup_name unbound
        alias          External DNS
        members        {% for host in groups["unbound"]|sort %}{{ host }}{% if not loop.last %}, {% endif %} {% endfor %}

}

{% for key, value in groups.items()|sort %}
{% if groups[key] != [] and key.startswith('copr')  %}
define hostgroup{
       hostgroup_name {{ key }}
       alias          {{ key }}
       members        {% for host in groups[key]|sort %}{% if hostvars[host].nagios_Can_Connect == true %}{{host}}, {% endif %}{% endfor %}

}
{% endif %}
{% endfor %}
